/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package th.quartz;

import com.google.inject.Inject;
import java.util.List;
import org.slf4j.Logger;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.StatefulJob;
import org.slf4j.LoggerFactory;
import th.manager.DeactivateUserManager;
import th.model.Pengguna;

/**
 *
 * @author fikri
 */
public class DeactivateUserProcess implements StatefulJob {

    @Inject
    private DeactivateUserManager mgr;
    private static Logger LOG = LoggerFactory.getLogger(DeactivateUserProcess.class);
    
    @Override
    public void execute(JobExecutionContext jec) throws JobExecutionException {
       List<Pengguna> list = mgr.getInactiveList();
       if (!list.isEmpty()) mgr.inActivateUser(list);
       list = mgr.getDeactiveList();
       if (!list.isEmpty()) mgr.deActivateUser(list);
    }
    
}
